from PySide6.QtWidgets import QWidget, QVBoxLayout, QFormLayout, QSpinBox, QCheckBox, QComboBox

class SettingsTab(QWidget):
    def __init__(self):
        super().__init__()
        layout = QVBoxLayout()

        # 设置表单布局
        form_layout = QFormLayout()

        # 查询间隔设置
        self.interval_spin = QSpinBox()
        self.interval_spin.setRange(1, 60)
        self.interval_spin.setValue(5)
        self.interval_spin.setSuffix(" 秒")

        # 通知方式选择
        self.notify_combo = QComboBox()
        self.notify_combo.addItems(["系统通知", "声音提示", "邮件通知"])

        # 自动提交勾选
        self.auto_submit_check = QCheckBox("有票时自动提交订单")

        # 布局组合
        form_layout.addRow("监控查询间隔:", self.interval_spin)
        form_layout.addRow("通知方式:", self.notify_combo)
        form_layout.addRow("", self.auto_submit_check)

        layout.addLayout(form_layout)
        self.setLayout(layout)

    def get_settings(self):
        """获取当前设置参数"""
        return {
            'interval': self.interval_spin.value(),
            'notify_type': self.notify_combo.currentText(),
            'auto_submit': self.auto_submit_check.isChecked()
        }